home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
c
/
mnsbm.zip
/
WORDS.CB
< prev
next >
Wrap
Text File
|
1989-10-31
|
8KB
|
355 lines
/* Program Name: words.m */
/* Author: James M. Rodriguez */
/* Solution Systems Inc. */
/* This macro was designed to employ some rudimentary word-processing */
/* functions in Brief. It creates a menu from WORDS.MNU which must */
/* be located in your HELP directory. The macro INCLUDEs an EPSON.H */
/* which defines the escape codes for your printers functions. */
/* Text must be in a marked block. NO line markings are permitted. */
#include "dialog.h"
#include "epson.cb"
words (...)
{
extern temp_str;
int sys_buff;
temp_str = "NULL";
_process_menu (40, 17, 70, 6, "WP Functions", " ─┘ to select", "words.mnu", NULL, "_words_select");
if (temp_str != "NULL")
{
execute_macro (temp_str);
}
raise_anchor ();
}
_words_select (...)
{
int event_type,
menu_line;
get_parm (0, event_type);
switch (event_type)
{
case DIALOG_ESCAPE:
temp_str = "NULL";
case DIALOG_GREY_MINUS:
temp_str = "NULL";
case DIALOG_PICK_MENU:
{
get_parm (2, temp_str);
temp_str = trim (substr (temp_str, index (temp_str, ";") + 1, 12));
exit ();
}
case DIALOG_ALTER_MENU:
{
get_parm (2, temp_str);
message ("%s", substr (temp_str, index (temp_str, "|") + 1));
}
}
returns TRUE;
}
_bold (...)
{
int start_line,
start_col,
end_line,
end_col;
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
move_abs (start_line, start_col);
insert (BOLD_ON_CHAR);
if (start_line == end_line)
move_abs (end_line, 2 + end_col);
else
move_abs (end_line, 1 + end_col);
insert (BOLD_OFF_CHAR);
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_ital (...)
{
int start_line,
start_col,
end_line,
end_col;
save_position ();
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
move_abs (start_line, start_col);
insert (ITALIC_ON_CHAR);
if (start_line == end_line)
move_abs (end_line, 2 + end_col);
else
move_abs (end_line, 1 + end_col);
insert (ITALIC_OFF_CHAR);
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_empha (...)
{
int start_line,
start_col,
end_line,
end_col;
save_position ();
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
move_abs (start_line, start_col);
insert (EMPHASIZE_ON_CHAR);
if (start_line == end_line)
move_abs (end_line, 2 + end_col);
else
move_abs (end_line, 1 + end_col);
insert (EMPHASIZE_OFF_CHAR);
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_wide (...)
{
int start_line,
start_col,
end_line,
end_col,
bold_line;
save_position ();
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
bold_line = start_line;
if (start_line == end_line)
{
move_abs (bold_line, start_col);
insert (WIDE_ON_CHAR);
if (bold_line == end_line)
move_abs (bold_line, 2 + end_col);
else
move_abs (bold_line, 1 + end_col);
insert (WIDE_OFF_CHAR);
bold_line = end_line;
}
while (end_line != bold_line)
{
move_abs (bold_line, start_col);
insert (WIDE_ON_CHAR);
if (bold_line == end_line)
move_abs (bold_line, 2 + end_col);
else
move_abs (bold_line, 1 - end_of_line ());
insert (WIDE_OFF_CHAR);
++bold_line;
}
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_und (...)
{
int start_line,
start_col,
end_line,
end_col;
save_position ();
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
move_abs (start_line, start_col);
insert (UNDERLINE_ON_CHAR);
if (start_line == end_line)
move_abs (end_line, 2 + end_col);
else
move_abs (end_line, 1 + end_col);
insert (UNDERLINE_OFF_CHAR);
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_conden (...)
{
int start_line,
start_col,
end_line,
end_col;
save_position ();
if (0 < inq_marked (start_line, start_col, end_line, end_col))
{
save_position ();
move_abs (start_line, start_col);
insert (CONDENSED_ON_CHAR);
if (start_line == end_line)
move_abs (end_line, 2 + end_col);
else
move_abs (end_line, 1 + end_col);
insert (CONDENSED_OFF_CHAR);
restore_position ();
}
else
message ("NO MARKED BLOCK PROCESSS-ABORTED");
}
_paginate (...)
{
int flag,
head_space,
line_count;
flag = 0;
save_position ();
end_of_buffer ();
inq_position (line_count, NULL);
top_of_buffer ();
translate (HEADER_SPACE, "", 1, 1, 0, 1);
top_of_buffer ();
insert (HEADER_SPACE);
flag = line_count / LINES;
while (0 < flag)
{
goto_line (LINES * flag);
--flag;
insert (HEADER_SPACE);
}
restore_position ();
}
_strip (...)
{
top_of_buffer ();
translate (BOLD_ON_CHAR, "", 1, 1, 0, 1);
translate (BOLD_OFF_CHAR, "", 1, 1, 0, 1);
translate (ITALIC_ON_CHAR, "", 1, 1, 0, 1);
translate (ITALIC_OFF_CHAR, "", 1, 1, 0, 1);
translate (HEADER_SPACE, "", 1, 1, 0, 1);
translate (EMPHASIZE_ON_CHAR, "", 1, 1, 0, 1);
translate (EMPHASIZE_OFF_CHAR, "", 1, 1, 0, 1);
translate (WIDE_ON_CHAR, "", 1, 1, 0, 1);
translate (WIDE_OFF_CHAR, "", 1, 1, 0, 1);
translate (UNDERLINE_ON_CHAR, "", 1, 1, 0, 1);
translate (UNDERLINE_OFF_CHAR, "", 1, 1, 0, 1);
translate (CONDENSED_ON_CHAR, "", 1, 1, 0, 1);
translate (CONDENSED_OFF_CHAR, "", 1, 1, 0, 1);
}
_printer (...)
{
string last_char,
tab_reply,
quality_char,
quality_on_char,
quality_off_char,
pitch_char,
pitch_on_char,
pitch_off_char;
int old_buffer,
temp_buffer,
tab_stop;
old_buffer = inq_buffer ();
set_buffer (old_buffer);
attach_buffer (old_buffer);
inq_names (last_char, NULL, NULL);
while (0 < search_string ("\\", last_char, 1, 0))
{
last_char = substr (last_char, 1 + search_string ("\\", last_char, 1, 0));
message ("%s", last_char);
}
tab_stop = search_string (".", last_char, NULL, 1, 0);
last_char = substr (last_char, 1, tab_stop - 1);
last_char += ".WPF";
del (last_char);
temp_buffer = create_buffer (last_char, last_char);
set_buffer (old_buffer);
attach_buffer (old_buffer);
top_of_buffer ();
drop_anchor (3);
end_of_buffer ();
copy ();
set_buffer (temp_buffer);
attach_buffer (temp_buffer);
top_of_buffer ();
drop_anchor (3);
end_of_buffer ();
delete_block ();
top_of_buffer ();
paste ();
top_of_buffer ();
refresh ();
get_parm (0, pitch_char, "Enter pitch [10, 12, 15]: ", 4, PITCH);
pitch_char = substr (pitch_char, 1, 2);
switch (pitch_char)
{
case "10":
pitch_on_char = TEN_PT_ON;
case "12":
pitch_on_char = TWELVE_PT_ON;
case "15":
pitch_on_char = FIFTEEN_PT_ON;
}
get_parm (0, quality_char, "Enter Type Quality [DRAFT, LQ]: ", 5, QUALITY);
quality_char = upper (substr (quality_char, 1, 2));
switch (quality_char)
{
case "DR":
quality_on_char = DRAFT_ON;
case "LQ":
quality_on_char = LQ_ON;
}
insert (quality_on_char);
insert (pitch_on_char);
end_of_buffer ();
insert (PRN_RESET);
top_of_buffer ();
translate (BOLD_ON_CHAR, BOLD_ON, 1, 1, 0, 1);
translate (BOLD_OFF_CHAR, BOLD_OFF, 1, 1, 0, 1);
translate (ITALIC_ON_CHAR, ITALIC_ON, 1, 1, 0, 1);
translate (ITALIC_OFF_CHAR, ITALIC_OFF, 1, 1, 0, 1);
translate (EMPHASIZE_ON_CHAR, EMPHASIZE_ON, 1, 1, 0, 1);
translate (EMPHASIZE_OFF_CHAR, EMPHASIZE_OFF, 1, 1, 0, 1);
translate (WIDE_ON_CHAR, WIDE_ON, 1, 1, 0, 1);
translate (WIDE_OFF_CHAR, WIDE_OFF, 1, 1, 0, 1);
translate (UNDERLINE_ON_CHAR, UNDERLINE_ON, 1, 1, 0, 1);
translate (UNDERLINE_OFF_CHAR, UNDERLINE_OFF, 1, 1, 0, 1);
translate (CONDENSED_ON_CHAR, CONDENSED_ON, 1, 1, 0, 1);
translate (CONDENSED_OFF_CHAR, CONDENSED_OFF, 1, 1, 0, 1);
write_buffer ();
set_buffer (old_buffer);
attach_buf